import request from '@/utils/request.js';

//获取用户列表
export function selectUserList(query){
    return request({
        url:'/user/selectUserList',
        method:'get',
        params:query
    })
}

export function getUser(userId){
    return request({
        url:'/user/getUserByUserId/'+userId,
        method:'get'
    })
}

/**
 * 
 * @returns 班级信息
 */
export function getClassesInfo(){
    return request({
        url:'/user/getClassesInfo',
        method:'get'
    })
}
// //获取用户列表
// export function getList(query){
//     return request({
//         url:'/user/getList',
//         method:'get',
//         params:query
//     })
// }

/**
 * 
 * 根据user_id删除用户
 */
export function deleteUser(userId){
    return request({
        url:'/user/delete/'+userId,
        method:'delete'
    })
}
/**
 * 
 * @param {} data 
 */
export function deleteUsers(data){
    return request({
        url: '/user/deleteBatch',
        method: 'post',
        params: {
            userIds: data
        }
    })
}

/**
 * 
 * 更新用户信息
 */
export function updateUser(data){
    return request({
        url:'/user/updateUser',
        method:'put',
        data:data
    })
}
/**
 * 检查账号是否可用
 */
export function checkUsername(username){
    return request({
        url:'/user/checkUsername/'+username,
        method:'get',
    })
}
/**
 * 重置密码
 */
export function resetPwd(userId){
    return request({
        url:'/user/resetPwd/'+userId,
        method:'get',
    })
}

/**
 * 添加用户
 */
export function addUser(user){
    return request({
        url:'/user/addUser',
        method:'post',
        data:user,
    })
}

/***
 * 导入用户
 */
export function importUser(data){
    return request({
        url:'/user/importUser',
        method:'post',
        data: data
    })
}
/**
 * 导出用户
 * @returns 
 */
export function exportUser(){
    return request({
        url:'/user/exportUser',
        method:'get'
    })
}

export function getUser1(userId){
    return request({
        url:'/user/getUser?userId='+userId,
        method:'post',
    })
}

export function savePassword(userId,password){
    return request({
        url:'/user/savePassword',
        method:'post',
        params:{
            userId:userId,
            password:password,
        }
    })
}

export function getAdmin(userId){
    return request({
        url:'/user/getAdmin?userId='+userId,
        method:'post',
    })
}